﻿<script type="text/javascript">
    $.parser.onComplete = function () {
        var d = new Date();
        $("#riqi_kaishi_pandian_shuinihesuan").datebox('setValue', d.toLocaleDateString());
        $("#riqi_jieshu_pandian_shuinihesuan").datebox('setValue', d.toLocaleDateString());

        $("#zhandian_pandian_shuinihesuan").combobox({
            url: 'json/zhandian.json',
            method: 'get',
            valueField: 'zhandian',
            textField: 'zhandian',
            panelWidth: 175,
            panelHeight: 'auto',
            editable: false,
            onLoadSuccess: function () {
                $("#tbl_pandian_shuinihesuan").datagrid({
                    url: "handler/hesuan_pandian_shuini.ashx",
                    method: "get",
                    queryParams: {
                        requestType: '1',
                        uid: window.uid,
                        kid: window.kid,
                        kaishi: $("#riqi_kaishi_pandian_shuinihesuan").datebox('getValue'),
                        jieshu: $("#riqi_kaishi_pandian_shuinihesuan").datebox('getValue'),
                        zhandian: $("#zhandian_pandian_shuinihesuan").combobox('getText')
                    },
                    height: document.body.scrollHeight - 180,
                    loadFilter: function (data) {
                        for (var i = 0; i < data.length; i++) {
                            if (data[i].pandianriqi) {
                                data[i].pandianriqi = data[i].pandianriqi.substring(0, 10);
                            }
                            else {
                                data[i].pandianriqi = "合计：";
                            }
                        }
                        return data;
                    },
                    onSelect: function (index, row) {
                        $("#tbl_pandian_shuinihesuan_shigongxiangqing").datagrid({
                            url: "handler/hesuan_pandian_shuini.ashx",
                            method: "get",
                            queryParams: {
                                requestType: '2',
                                uid: window.uid,
                                kid: window.kid,
                                hesuanid: row.id
                            },
                            loadFilter: function (data) {
                                for (var i = 0; i < data.length; i++) {
                                    data[i].riqi = data[i].riqi.substring(0, 10);
                                }
                                return data;
                            },
                            onSelect: function (index, row) {
                                $("#tbl_pandian_shuinihesuan_peihebixinxi").datagrid({
                                    url: "handler/hesuan_pandian_shuini.ashx",
                                    method: "get",
                                    queryParams: {
                                        requestType: '3',
                                        uid: window.uid,
                                        kid: window.kid,
                                        kaipanriqi: row.riqi,
                                        zhandian: row.zhandian,
                                        gongcheng: row.gongcheng
                                    },
                                    loadFilter: function (data) {
                                        for (var i = 0; i < data.length; i++) {
                                            data[i].peibiriqi = data[i].peibiriqi.substring(0, 10);
                                        }
                                        return data;
                                    }
                                });
                            }
                        });
                    }
                });
            }
        });
    }


    $("#chaxun_pandian_shuinihesuan").click(function () {
        $("#tbl_pandian_shuinihesuan").datagrid('load', {
            requestType: '1',
            uid: window.uid,
            kid: window.kid,
            kaishi: $("#riqi_kaishi_pandian_shuinihesuan").datebox('getValue'),
            jieshu: $("#riqi_jieshu_pandian_shuinihesuan").datebox('getValue'),
            zhandian: $("#zhandian_pandian_shuinihesuan").combobox('getText')
        });
    });

    $("#daochu_pandian_shuinihesuan").click(function () {
        //导出
        var dateKaiShi = $("#riqi_kaishi_pandian_shuinihesuan").datetimebox('getValue');
        var dateJieShu = $("#riqi_jieshu_pandian_shuinihesuan").datetimebox('getValue');
        var zhanDianStr = $("#zhandian_pandian_shuinihesuan").combobox('getText').replace('#', "_");
        var yongHu = $("#currentUser").text();
        window.open(encodeURI("http://keaomds.com:10001/?uid=" + window.uid + "&kid=" + window.kid + "&requestType=12&keHuBianHao=" + window.kehubianhao + "&zhandian=" + zhanDianStr + "&kaishi=" + dateKaiShi + "&jieshu=" + dateJieShu + "&yonghu=" + yongHu));

    });

    function shiGongInfo_shuinihesuan() {
        $("#pandian-shigong-info-shuinihesuan").dialog('open');
    }

    function peiHeBiInfo_shuinihesuan() {
        $("#pandian-peihebi-info-shuinihesuan").dialog('open');
    }

</script>

<div class="easyui-panel" data-options="height:90,border:false" title="数据检索" style="border-top-width: 0px;
    border-bottom-width: 1px; padding: 15px; width:100%">
    <table style="font-size: 12px;">
        <tr>
            <td>
                站点：
            </td>
            <td>
                <input class="easyui-combobox" name="zhandian_pandian_shuinihesuan" id="zhandian_pandian_shuinihesuan" style="width: 175px;" />
            </td>
            <td>
                盘点日期：
            </td>
            <td>
                <input id="riqi_kaishi_pandian_shuinihesuan" type="text" class="easyui-datebox" data-options="required:true"
                       style="width: 120px">
            </td>
            <td>
                至
            </td>
            <td>
                <input id="riqi_jieshu_pandian_shuinihesuan" type="text" class="easyui-datebox" data-options="required:true"
                       style="width: 120px">
            </td>
            <td>
                <a id="chaxun_pandian_shuinihesuan" class="easyui-linkbutton" data-options="iconCls:'icon-search'"
                   style="width: 60px; margin-left: 20px;">查询</a>
            </td>
            <td>
                <a id="daochu_pandian_shuinihesuan" class="easyui-linkbutton" data-options="iconCls:'icon-export-16'"
                   style="width: 60px">导出</a>
            </td>

        </tr>
    </table>
</div>

<table id="tbl_pandian_shuinihesuan" class="easyui-datagrid" title="水泥盘点核算" data-options="border:false,singleSelect:true,collapsible:false,striped:true,fitColumns:true" style="width:100%">
    <thead>
        <tr>
            <th data-options="field:'pandianriqi'">
                盘点日期
            </th>
            <th data-options="field:'shuiwenliaoshejiliang'">
                设计混合料(t)
            </th>
            <th data-options="field:'shejixiaohao'">
                水泥设计量(t)
            </th>
            <th data-options="field:'pandianxiaohao'">
                实际消耗(t)
            </th>
            <th data-options="field:'yingkui'">
                盈亏(t)
            </th>
            <th data-options="field:'yingkuibili'">
                盈亏比例(%)
            </th>
            <th data-options="field:'shuiwenliaochukuganzhong'">
                施工干重(t)
            </th>
            <th data-options="'field':'shigongshuinijiliang'">
                施工水泥剂量(%)
            </th>
            <th data-options="field:'id',formatter:function(value,row,index){if(value){ return '<a href=javascript:void(0) onClick=shiGongInfo_shuinihesuan()>施工信息</a>';}}">
            </th>
        </tr>
    </thead>
</table>


<div id="pandian-shigong-info-shuinihesuan" class="easyui-dialog" title="施工信息详情" data-options="modal:true,closed:true,iconCls:'icon-tip',draggable:false,collapsible:false,minimizable:false,maximizable:false,resizable:false"
     style="width: 900px; height: 500px; padding: 2px;">
    <table id="tbl_pandian_shuinihesuan_shigongxiangqing" class="easyui-datagrid" title="盘点周期内施工详情" data-options="border:false,singleSelect:true,collapsible:false,striped:true,fitColumns:true" style="width:100%">
        <thead>
            <tr>
                <th data-options="field:'riqi'">
                    开盘日期
                </th>
                <th data-options="field:'gongcheng'">
                    分项工程
                </th>
                <th data-options="field:'biaoduanmingcheng'">
                    段落桩号
                </th>
                <th data-options="field:'zuoyoufu'">
                    左右幅
                </th>
                <th data-options="field:'biaoduanchangdu'">
                    长度(m)
                </th>
                <th data-options="field:'biaoduankuandu'">
                    宽度(m)
                </th>
                <th data-options="field:'biaoduanhoudu'">
                    厚度(m)
                </th>
                <th data-options="field:'ganmidu'">
                    最大干密度(t/m³)
                </th>
                <th data-options="field:'jihualiang'">
                    设计量(t)
                </th>
                <th data-options="field:'zhandian',hidden:true">
                    站点
                </th>
                <th data-options="field:'id',formatter:function(value,row,index){if(value){ return '<a href=javascript:void(0) onClick=peiHeBiInfo_shuinihesuan()>查看配合比</a>';}}">
                </th>
            </tr>
        </thead>
    </table>
</div>

<div id="pandian-peihebi-info-shuinihesuan" class="easyui-dialog" title="配合比" data-options="modal:true,closed:true,iconCls:'icon-tip',draggable:false,collapsible:false,minimizable:false,maximizable:false,resizable:false"
     style="width: 500px; height: 300px; padding: 2px;">
    <table id="tbl_pandian_shuinihesuan_peihebixinxi" class="easyui-datagrid" title="配合比信息" data-options="border:false,singleSelect:true,collapsible:false,striped:true,fitColumns:true" style="width:100%">
        <thead>
            <tr>
                <th data-options="field:'peibiriqi'">
                    开盘日期
                </th>
                <th data-options="field:'gongcheng'">
                    分项工程
                </th>
                <th data-options="field:'guanlianwuliao'">
                    配比物料
                </th>
                <th data-options="field:'peibi'">
                    配比
                </th>
            </tr>
        </thead>
    </table>
</div>